Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

uint8arrays

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uint8arrays

Utility functions to make dealing with Uint8Arrays easier

  • 5.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
834K
decreased by-16.15%
Maintainers
1
Weekly downloads
 
Created

What is uint8arrays?

The uint8arrays npm package provides utilities for working with Uint8Array objects in JavaScript. It includes functions for concatenation, comparison, conversion to and from strings, and more.

What are uint8arrays's main functionalities?

Concatenation

This feature allows you to concatenate multiple Uint8Array objects into a single Uint8Array.

const uint8arrays = require('uint8arrays');
const arr1 = new Uint8Array([1, 2, 3]);
const arr2 = new Uint8Array([4, 5, 6]);
const concatenated = uint8arrays.concat([arr1, arr2]);
console.log(concatenated); // Uint8Array [1, 2, 3, 4, 5, 6]

Comparison

This feature allows you to compare two Uint8Array objects for equality.

const uint8arrays = require('uint8arrays');
const arr1 = new Uint8Array([1, 2, 3]);
const arr2 = new Uint8Array([1, 2, 3]);
const arr3 = new Uint8Array([4, 5, 6]);
console.log(uint8arrays.equals(arr1, arr2)); // true
console.log(uint8arrays.equals(arr1, arr3)); // false

Conversion to and from Strings

This feature allows you to convert Uint8Array objects to and from strings using various encodings.

const uint8arrays = require('uint8arrays');
const arr = new Uint8Array([72, 101, 108, 108, 111]);
const str = uint8arrays.toString(arr, 'utf8');
console.log(str); // 'Hello'
const newArr = uint8arrays.fromString('Hello', 'utf8');
console.log(newArr); // Uint8Array [72, 101, 108, 108, 111]

Other packages similar to uint8arrays

FAQs

Package last updated on 10 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc